import App from './App'
import {createSSRApp} from 'vue'

import nav from './components/nav/nav.vue'//全局注册组件
import utils from './utils/utils'
import api from './utils/API.js'
import * as Pinia from 'pinia';// pinia
import {mixinfun} from './mixin/index.js'
export const app = createApp(App)

export function createApp() {
	const app = createSSRApp(App)
	app.mixin(mixinfun)
	app.config.globalProperties.$utils = utils;
	app.config.globalProperties.$api = api;
	app.config.globalProperties.$showToast=function(title, duraction = 1000, icon = 'none'){
		uni.showToast({
			title: title,
			icon: icon,
			duration: duraction
		})
	}
	app.use(Pinia.createPinia());
	app.component('navNav',nav)//全局注册组件
	return {
		app,
		Pinia
	}
}
